import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [

  {
    path: '/',
    redirect: '/home/index'  // 重定向
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: 'index',
        component: () => import('../views/index/IndexView.vue')
      },
      {
        path: 'activity',
        component: () => import('../views/activity/ActivityClassification.vue'),
      },
      {
        path: 'shop',
        component: () => import('../views/shop/ShopView.vue'),
      },
      {
        path: 'me',
        component: () => import('../views/me/MeView.vue'),
      },
      {
        path: 'huobao',
        component: () => import('../views/index/HuoBao.vue'),
      },
    ]
  },

  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
